
#ifndef CSharpMutex_h
#define CSharpMutex_h

// Std includes.
#include <variant_map.h>

#if Android
#	include <pthread.h>
#endif

// This class will wrap the platform independent mutex object.
// Uses internal for Riccsson.System library with the 'Lock' and 'GC_PTR' objects.
class Mutex
{
#if Windows
	void* m_mutex;
#elif Android
	pthread_mutex_t Mutex;
	pthread_mutexattr_t Attr;
#endif

public:
	int _count;
	void* _instance;

	Mutex(void* instance);
	void Lock();
	void Unlock();
	~Mutex();
};

extern std::map2<void*, Mutex*> s_instanceLocked;

#endif